<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>门店管理</title>
    <#include "/common/link.ftl">
    <script>
        $(function () {
            // 日期高级查询应该用让用户选择
            $('.input-date').datepicker({
                format: 'yyyy-mm-dd', //格式
                language: 'zh-CN', //中文
                autoclose: true,//选择后自动关闭
                //showMeridian:true, //是否显示上下午
                minView: 2,//精确到哪位
            });

            // 门店详情
            $('.part').click(function () { //给按钮一个点击事件
                let id = $(this).data('id'); // 通过被点击的按钮拿到id
                // 通过异步请求的方式
                $.get('/business/part', 'id=' + id, function (data) {
                    $('#name').html(data.name);
                    $('#intro').html(data.intro);
                    $('#scope').html(data.scope);
                    $('#address').html(data.address);
                    $('#openDate').html(data.openDate);
                });
                $('#myModal').modal('show'); //展示模态框
            });
        });
    </script>
</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="business"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>门店管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 20px 0px 0px 10px">
                    <form class="form-inline" id="searchForm" action="/business/list" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <div class="form-group">
                            <label for="name">门店名称：</label>
                            <input type="text" class="form-control" name="name" value="${qo.name}"
                                   placeholder="请输入门店名称">
                        </div>
                        <div class="form-group">
                            <label for="scope">经营范围：</label>
                            <input type="text" class="form-control" name="scope" value="${qo.scope}"
                                   placeholder="请输入经营范围">
                        </div>
                        <div class="form-group">
                            <label for="tel">门店联系方式：</label>
                            <input type="text" class="form-control" name="tel" value="${qo.tel}"
                                   placeholder="请输入门店联系方式">
                        </div>
                        <div class="form-group">
                            <label for="legalName">根据法人查询：</label>
                            <input type="text" class="form-control" name="legalName" value="${qo.legalName}"
                                   placeholder="请输入法人姓名">
                        </div>

                        <br/>
                        <br/>
                        <div class="form-group">
                            <label>经营日期查询：</label>
                            <input placeholder="请输入开始日期" autocomplete="off" type="text" class="form-control input-date"
                                   name="beginDate" value="${qo.beginDate}"/> -
                            <input placeholder="请输入结束日期" autocomplete="off" type="text" class="form-control input-date"
                                   name="endDate" value="${qo.endDate}"/>
                        </div>

                        <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span>
                            查询
                        </button>

                        <a href="/business/input" class="btn btn-success">
                            <span class="glyphicon glyphicon-plus"></span> 添加
                        </a>
                    </form>

                </div>
                <div class="box-body table-responsive">
                    <table class="table table-hover table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>门店名称</th>
                            <th>门店电话</th>
                            <th>门店地址</th>
                            <th>经营时间</th>
                            <th>门店性质</th>
                            <th>查看详情</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#list pageInfo.list as b>
                            <tr>
                                <td>${b_index+1}</td>
                                <td>${b.name!}</td>
                                <td>${b.tel!}</td>
                                <td>${b.address!}</td>
                                <td>${b.openDate?string("yyyy-MM-dd")!}</td>
                                <#--<td>${(b.mainStore==1)?string("总店","分店")!}</td>-->
                                <td>${b.storeDisplay!}</td>
                                <td>
                                    <a data-id="${b.id!}" class="part btn btn-info">
                                        <span class="glyphicon glyphicon-search"></span> 门店详情
                                    </a>
                                </td>
                                <td>
                                    <a href="/business/input?id=${b.id}" class="btn btn-info btn-xs">
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>
                                </td>
                            </tr>
                        </#list>
                        </tbody>
                    </table>
                    <#-- 分页-->
                    <#include "/common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>


<!--门店详情 Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">门店详情</h4>
            </div>
            门店名称:
            <div class="modal-body" id="name"></div>
            门店简介:
            <div class="modal-body" id="intro"></div>
            经营范围:
            <div class="modal-body" id="scope"></div>
            门店地址:
            <div class="modal-body" id="address"></div>
            经营时间:
            <div class="modal-body" id="openDate"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>
